package com.briup.jz.service.impl;

import com.briup.jz.bean.BaseRolePrivilege;
import com.briup.jz.dao.BaseRolePrivilegeMapper;
import com.briup.jz.dao.CertificationApplyMapper;
import com.briup.jz.service.IBaseRolePrivilegeService;
import com.briup.jz.utils.CustomerException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class BaseRolePrivilegeServiceImpl implements IBaseRolePrivilegeService {

    @Resource
    private BaseRolePrivilegeMapper baseRolePrivilegeMapper;


    @Override
    public void saveOrUpdat(BaseRolePrivilege baseRolePrivilege) throws CustomerException {

        if (baseRolePrivilege.getId()!=null){
            //更新操作
            baseRolePrivilegeMapper.updateByPrimaryKey(baseRolePrivilege);
        }else {
            baseRolePrivilegeMapper.insert(baseRolePrivilege);
        }
    }

    @Override
    public BaseRolePrivilege query(Long id) {
       return  baseRolePrivilegeMapper.selectByPrimaryKey(id);
    }

    @Override
    public void deleteById(Long id) throws CustomerException {

        baseRolePrivilegeMapper.deleteByPrimaryKey(id);
    }
}
